package com.c201801020208.ybl.Login.Activity;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.c201801020208.ybl.Login.BlankFragment1;
import com.c201801020208.ybl.Login.BlankFragment2;
import com.c201801020208.ybl.Login.BlankFragment3;
import com.c201801020208.ybl.Login.ViewPagerFragment;
import com.c201801020208.ybl.R;

import java.util.ArrayList;
import java.util.List;

public class SelectActivity extends AppCompatActivity {
    private ViewPager vp;
    private List<ViewPagerFragment> list = new ArrayList<>();
    Button button1;
    Button button2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_select);

        button1 = findViewById(R.id.button10);
        button2 = findViewById(R.id.button11);


        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SelectActivity.this, Login2Activity.class);
                startActivity(intent);
                finish();
            }
        });

        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(SelectActivity.this, LoginActivity.class);
                startActivity(intent);
                finish();
            }
        });

        //viewpager加载图片
        BlankFragment1 blankFragment1 = new BlankFragment1();
        list.add(blankFragment1);
        BlankFragment2 blankFragment2 = new BlankFragment2();
        list.add(blankFragment2);
        BlankFragment3 blankFragment3 = new BlankFragment3();
        list.add(blankFragment3);


        vp = (ViewPager) findViewById(R.id.vp);
        vp.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
            @NonNull
            @Override
            public Fragment getItem(int position) {
                return list.get(position);
            }

            @Override
            public int getCount() {
                return list.size();
            }
        });

    }
}
